<!DOCTYPE html>
<html xmlns:th="www.thymeleaf.org">
<meta charset="UTF-8">
<head th:replace="back/index::ph('新增课程')"></head>
<body>
	<header th:replace="back/index::header"></header>
	<main>
		<div class="content">
			<fieldset>
				<legend><a href="/">首页</a> >> 新增课程</legend>
				<div class="form">
				阶段：<input v-model="data.stage" type="number"><br>
				名称：<input v-model="data.name"><br>
				排序：<input v-model="data.sort" type="number"><br>
				<button @click="save">添加</button>
				</div>
			</fieldset>
		</div>
	</main>
	<footer th:replace="back/index::footer"></footer>
</body>
<script type="text/javascript">
	var v = new Vue({
		el : "main",
		data : {
			data : { stage:1, name:"", sort:1}
		},
		methods : {
			save(){
				axios.post("hwctask/course/save", usp(this.data)).then(res=>{
					if(res.data.code==1){
						location.href = "go_course_query";
					} else {
						alert(res.data.msg);
						console.info(res.data);
					}
				});
			}
		}
	});


</script>
</html>